home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / tabvie.zip / TABVIEW.H < prev    next >
C/C++ Source or Header  |  1994-04-13  |  4KB  |  110 lines

  1. #ifndef TABVIEW_H
  2. #define TABVIEW_H
  3.  
  4. // tabview.h : interface of the CTabView class
  5. // Written by Gerry High
  6. // V1.2 4/13/94
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9.  
  10. class CTabInfo : public CObject
  11. {
  12. public:
  13.     CTabInfo(){m_tabWidth = 0;m_tabLabel = NULL;m_pView = NULL;m_mnemonic = (char)0;m_active=TRUE;}
  14.     ~CTabInfo()
  15.     {
  16.         if(m_tabLabel)    delete m_tabLabel;
  17.         //don't need to delete view since it will
  18.         //be handled by the delete of the parent
  19. //        if(m_pView)     delete m_pView;
  20.     }
  21.     int         m_tabWidth;    // width of tab
  22.     char*         m_tabLabel;    // label of tab 
  23.     CView*         m_pView;    // pointer to CView object
  24.     char        m_mnemonic;    // character of mnemonic
  25.     BOOL        m_active;    //is this tab active?
  26. };
  27.  
  28. enum eLookAndFeel { LAF_CHICAGO,LAF_MSWORD};
  29. enum eTabPosition 
  30. { TABSONTOP, TABSONLEFT, TABSONLEFTBOT,TABSONRIGHT, TABSONRIGHTBOT, TABSONBOTTOM };
  31.  
  32. class CTabView : public CView             
  33. {
  34. protected: // create from serialization only
  35.     CTabView();
  36.     DECLARE_DYNCREATE(CTabView)
  37.  
  38. // Attributes
  39. public:
  40.  
  41. // Operations
  42. public:
  43.  
  44. // Implementation
  45. public:
  46.     virtual         ~CTabView();
  47.     virtual void     OnDraw(CDC* pDC);  // overridden to draw this view
  48.     virtual void     OnInitialUpdate();
  49.  
  50.     virtual CView*     addTabView(CRuntimeClass* viewClass,CDocument* document,
  51.                     char* tabLabel,    BOOL border = FALSE,BOOL show = TRUE,int tabWidth = 100);
  52.     BOOL             doSysCommand(UINT nID,LONG lParam);
  53.     void            enableView(int viewIndex, BOOL bEnable = TRUE);
  54.     void            setFrameBorderOn(BOOL on = TRUE);
  55.     void            setLAF(eLookAndFeel LAF=LAF_MSWORD);
  56.     void            setMargin(int margin=7);
  57.     void            setTabHeight(int height=25);
  58.     void            setTabPosition(eTabPosition tabPos=TABSONTOP);
  59.     virtual void     switchTab(int viewIndex);
  60. protected:
  61.     virtual CView*     createTabView(CRuntimeClass* viewClass,CDocument* document,CWnd* parentWnd,
  62.                     BOOL border,BOOL show);
  63.     
  64. #ifdef _DEBUG
  65.     virtual void     AssertValid() const;
  66.     virtual void     Dump(CDumpContext& dc) const;
  67. #endif
  68.  
  69.  
  70. // Generated message map functions
  71. protected:
  72.     //{{AFX_MSG(CTabView)
  73.     afx_msg BOOL     OnEraseBkgnd(CDC* pDC);
  74.     afx_msg void     OnSize(UINT nType, int cx, int cy);
  75.     afx_msg void     OnLButtonDown(UINT nFlags, CPoint point);
  76.     afx_msg void     OnSetFocus(CWnd* pOldWnd);
  77.     afx_msg int      OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  78.     //}}AFX_MSG
  79.     DECLARE_MESSAGE_MAP()
  80.  
  81.     void            createFonts();
  82.     void             drawChicagoTabs(CDC *pDC, CPen& blackPen, CPen& darkPen, CPen& lightPen, CPen *pOldPen);
  83.     void             drawMSWordTabs(CDC *pDC, CPen& blackPen, CPen& darkPen, CPen& lightPen, CPen *pOldPen);
  84.     void             drawMSWordTopTabs(CDC *pDC, CPen& blackPen, CPen& darkPen, CPen& lightPen, CPen *pOldPen);
  85.     void             drawMSWordLeftTabs(CDC *pDC, CPen& blackPen, CPen& darkPen, CPen& lightPen, CPen *pOldPen);
  86.     void             drawMSWordRightTabs(CDC *pDC, CPen& blackPen, CPen& darkPen, CPen& lightPen, CPen *pOldPen);
  87.     void            repositionViews();
  88.     BOOL            switchTopTab(CPoint point);
  89.     BOOL            switchVerticalTab(CPoint point);
  90.     int m_width;                 //view width
  91.     int m_height;                //view height
  92.     int m_curTab;                //index of current tab
  93.     int m_nTabs;                //number of tabs
  94.     int m_tabHeight;            //height of a tab (including margins, etc.)
  95.     CObArray     m_tabArray;        //array of CTabInfo objects
  96.     CView*         m_curView;        //current view
  97.     eLookAndFeel    m_lookAndFeel;    // Look of Tabs (either LAF_CHICAGO or LAF_MSWORD)
  98.     
  99.     int         m_margin;        //margin around tab "pages"
  100.     eTabPosition    m_position;        //position of tabs
  101.     int         m_lfEscapement;    //font escapement (rotation)
  102.     BOOL        m_frameBorderOn;// draw tab page frame?
  103.  
  104.     CFont* m_normalFont;        //font of non-current tab
  105.     CFont* m_boldFont;            //font of current tab
  106. };
  107.  
  108. /////////////////////////////////////////////////////////////////////////////
  109. #endif //TABVIEW_H
  110.